<?php

/*
|--------------------------------------------------------------------------
| Home Routes 前台路由
|--------------------------------------------------------------------------
|
|
*/

//首页
Route::get('/','Home\IndexController@index') -> middleware(['errors']);
//商品

Route::get('/product','Home\ProductController@index') -> middleware(['errors']);

Route::get('/cart','Home\CartController@index') ->middleware(['errors']);


Route::get('/errors','Admin\MaintainController@errors');

Route::get('/product','Home\ProductController@index');


//myhouse 收货地址路由
Route::get('/myhouse/address',"Home\AddressController@address");
Route::get('/myhouse/addressadd',"Home\AddressController@addressadd");
Route::post('/myhouse/insert',"Home\AddressController@insert");
Route::get('/myhouse/edit/{id}',"Home\AddressController@edit");
Route::post('/myhouse/update',"Home\AddressController@update");
Route::get('/myhouse/delete/{id}',"Home\AddressController@delete");

//收藏路由
Route::get('/collect',"Home\CollectController@index");
//添加收藏 传递商品id
Route::get('/collect/add',"Home\CollectController@add");
//删除收藏 传递收藏id
Route::get('/collect/del/{id}',"Home\CollectController@del");



//详情
Route::get('/single/{proid}','Home\ProductController@show')->name('single');
//点击数
Route::get('/chicknum/{proid}','Home\ProductController@chicknum');

//添加购物
Route::get('/cartadd','Home\CartController@add');
//删除购物
Route::get('/cartdel','Home\CartController@del');
//订单添加页面
Route::get('/order','Home\OrderController@create');
//订单添加处理
Route::post('/orderadd','Home\OrderController@store');


/*
|--------------------------------------------------------------------------
| Admin Routes 后台路由
|--------------------------------------------------------------------------
|
|
*/




//广告管理
Route::resource('admin/ad','Admin\AdController');

/*后台消息管理*/
//收件箱
Route::resource('admin/message/receive','Admin\MessageController@receive');
//发消息（带值）
Route::get('admin/messageall/create/{id}','Admin\MessageAllController@create');
//已发送
Route::resource('admin/message/send','Admin\MessageController@send');
//已删除
Route::resource('admin/message/delete','Admin\MessageController@delete');
Route::resource('admin/message/dodelete','Admin\MessageController@dodelete');
Route::resource('admin/message','Admin\MessageController');
//评价管理
Route::resource('admin/comment','Admin\CommentController');
/*
|--------------------------------------------------------------------------
| Home Routes 前台路由
|--------------------------------------------------------------------------
|
|
*/
//
//我的小屋
//消息
//收件箱
Route::resource('home/myhouse/message/receive','Home\MessageController@receive');
//已发送
Route::get('home/myhouse/message/send','Home\MessageController@send');
//已删除
Route::resource('home/myhouse/message/delete','Home\MessageController@delete');
Route::resource('home/myhouse/message/dodelete','Home\MessageController@dodelete');
Route::resource('home/myhouse/message','Home\MessageController');


//订单
//订单列表
Route::get('/home/myhouse/order','Home\OrderController@index')->name('myorder');
//订单详情
Route::get('/home/myhouse/order/show/{order_id}','Home\OrderController@show');
//支付
Route::get('/comment/take/pay/{order_id}','Home\OrderController@pay');
//支付成功
Route::post('/comment/take/dopay','Home\OrderController@dopay');
//删除订单
Route::get('/comment/take/delete/{order_id}','Home\OrderController@ord_delete');

//前台评价
//评价列表
Route::get('/comment/{id}','Home\CommentController@index');

//收货评价
Route::get('/comment/take/edit/{id}','Home\CommentController@edit');
Route::post('/comment/take/show','Home\CommentController@show');

//前台更改个人信息
Route::get('home/member','Home\MemberController@show');
Route::post('home/member/update','Home\MemberController@update');

//后台首页模块
Route::resource('admin/index','Admin\IndexController',['only'=>['index']]);
//后台会员模块
Route::get('admin/member/v_code/{id}','Admin\MemberController@v_code');
Route::resource('admin/member','Admin\MemberController',['except'=>['destroy']]);
Route::resource('admin/manage','Admin\ManageController');


//前台登录
Route::get('/login','Home\LoginController@login') ->middleware(['errors']);
Route::post('/dologin','Home\LoginController@doLogin') ->middleware(['errors']);
Route::get('/v_code/{id}','Home\LoginController@v_code');
Route::get('unsetsession','Home\LoginController@unsetSession');

//前台重置密码
Route::get('/reset','Home\ResetController@reset') ->middleware(['errors']);
Route::post('/send','Home\ResetController@send');
Route::get('/info','Home\ResetController@info');
Route::get('/new/member_id/{member_id}/token/{token}','Home\ResetController@newform');
Route::post('/update','Home\ResetController@update');

//前台注册
Route::get('/register','Home\RegisterController@register');
Route::post('/doregister','Home\RegisterController@doRegister');
Route::get('/createcode/{id}','Home\RegisterController@createCode');


//后台登录
Route::get('/admin/login','Admin\LoginController@login');
Route::post('/admin/dologin','Admin\LoginController@doLogin');



//商品分类
Route::get('admin/classify',"Admin\ClassifyController@index");
//品牌编辑
Route::get('admin/classify/{id}/brandedit',"Admin\ClassifyController@brandedit");
//商品编辑页面的验证码路由
Route::get('admin/classify/v_code/{id}','Admin\ClassifyController@v_code');
//品牌更新
Route::post('admin/classify/brandupdate',"Admin\ClassifyController@brandupdate");
//商品属性
Route::get('admin/classifyattr',"Admin\ClassifyController@classifyattr");

//支付方式
Route::get('admin/paymentmode',"Admin\PaymentmodeController@paymentmode");
//送货地区
Route::get('admin/region',"Admin\RegionController@region");
//送货地区编辑
Route::get('admin/region/{id}/regionedit',"Admin\RegionController@regionedit");
//送货地区更新
Route::post('admin/region/regionupdate',"Admin\RegionController@regionupdate");

//添加友情链接
Route::get('admin/frilink/add',"Admin\FrilinkController@add");
//添加友情链接
Route::post('admin/frilink/insert',"Admin\FrilinkController@insert");
//编辑友情链接
Route::get('admin/frilink/{id}/edit',"Admin\FrilinkController@edit");
//更新友情链接
Route::post('admin/frilink/update',"Admin\FrilinkController@update");
//修改状态
Route::get('admin/frilink/{id}/status',"Admin\FrilinkController@status");
//删除友情链接
Route::get('admin/frilink/{id}/delete',"Admin\FrilinkController@delete");
//友情链接
Route::get('admin/frilink',"Admin\FrilinkController@frilink");

//网站维护更新
Route::get('admin/maintain/edit',"Admin\MaintainController@edit");
Route::post('admin/maintain/update',"Admin\MaintainController@update");

//订单列表
Route::get('admin/order',"Admin\OrderController@index");
//订单状态修改
Route::get('admin/order/{id}/statusedit',"Admin\OrderController@statusedit");
//更新订单状态
Route::post('admin/order/update',"Admin\OrderController@update");
//商品模块

Route::resource('admin/product','Admin\ProductController',['except'=>['destroy']]);
//属性列表
Route::put('admin/productattrlist/{proid}','Admin\ProductAttrController@index');
//属性添加
Route::get('admin/productattr/{newproid}','Admin\ProductAttrController@create')->name('createattr');
//继续添加属性
Route::post('admin/productattrnext','Admin\ProductAttrController@storenext');
//处理添加属性 转到商品列表
Route::post('admin/productattr','Admin\ProductAttrController@store');
//属性更改
Route::get('admin/productattr/{pro_id}/edit/{cosir_id}','Admin\ProductAttrController@edit');
//处理属性更改
Route::post('admin/productattrupdate','Admin\ProductAttrController@update');





